import { request } from 'umi';

/** 请求所有资源接口 POST /api/links/getLinks */

export async function getLinks(body, options) {
  return request('/api/links/getLinks', {
    method: 'POST',
    data: body,
    ...(options || {}),
  });
}

/** 请求具体某个资源接口 POST /api/links/getLink */

export async function getLink(body, options) {
  return request('/api/links/getLink', {
    method: 'POST',
    data: body,
    ...(options || {}),
  });
}

/** 给某个资源点赞接口 GET /api/links/like */

export async function like(body, options) {
  return request('/api/links/like', {
    method: 'GET',
    params: body,
    ...(options || {}),
  });
}

/** 获得所有标签接口 GET /api/links/tags */

export async function getTags(body, options) {
  return request('/api/links/tags', {
    method: 'GET',
    ...(options || {}),
  });
}
/** 推荐资源 POST /api/links/addLink */

export async function addLink(body, options) {
  return request('/api/links/addLink', {
    method: 'POST',
    data: body,
    ...(options || {}),
  });
}
/** 上传图标 POST /api/links/uploadIcon */

export async function uploadIcon(body, options) {
  return request('/api/links/uploadIcon', {
    method: 'POST',
    data: body,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    ...(options || {}),
  });
}
